package com.cn.zmc.design.template;

public class TemplateMethod {


    public static void main(String[] args) {
        new Template1().invoke();
    }



    public static abstract class TemplateFactory {


        public void invoke() {
            commend();
            everyOneMethod();
        }

        abstract void everyOneMethod();

        public void commend() {
            System.out.println("通用逻辑");
        }

    }

    public static class Template1 extends TemplateFactory{

        @Override
        void everyOneMethod() {
            System.out.println("Template1");
        }
    }

    public static class Template2 extends TemplateFactory{

        @Override
        void everyOneMethod() {
            System.out.println("Template2");
        }
    }

    public static class Template3 extends TemplateFactory{

        @Override
        void everyOneMethod() {
            System.out.println("Template3");
        }
    }

}
